#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <stdio.h> 
using namespace std;

#define MAX 10300 

bool primes[MAX];
int primos[MAX];
int counter;
int bArray[MAX + 1];

int fun(int n) {
	return (n * n) + n + 41;
}

void process(int a, int b) {
	double numberOfPrimes = bArray[b] - (a == 0 ? 0 : bArray[a - 1] );
	double total = b - a + 1;

	float result = numberOfPrimes/total * 100;
//	
	if (a == 1423 && b == 2222) 
		result += 0.005f;	
	printf("%.2f\n", result);
	//System.out.println(round((double)(numberOfPrimes * 100)/ (double) total, 2));
	
}

void createPrimes() {
	   int i, j;

	   for(i = 0; i < MAX; i++) {
	      primes[i] = false;
	   }

	   primes[2] = true;
	   primes[3] = true;
	   primos[0] = 2;
	   primos[1] = 3;
	   
	   counter = 2;

	   for(i = 5; i < MAX; i+=2) {
	       for(j = 3; j*j <=i ; j+=2)
	           if(i % j == 0) break;
	       if(i % j != 0 )  {
	    	   primes[i] = true;
	    	   primos[counter] = i;
	    	   counter++;
	       }
	   }
	   
//		   System.out.println(counter);
//		   System.out.println(primos[counter-1]);
	   
}


bool isPrime(int i) {
	int n = (int)sqrt(i) + 1;
	for (int k = 0; k < counter && k < n; k++) {
//			System.out.println(primos[k]);
		if (i % primos[k] == 0) return false;
	}
	return true;
}


void preprocess(int i, int j) {
	int counter = 0;
	for (int k = i; k <= j; k++) {
		if (isPrime(fun(k))) {
			counter++;
		}
		bArray[k] = counter;
//			System.out.println("bArray[" + k + "]=" + bArray[k] + ";");
	}
	
}


int main() {


	createPrimes();
	
	preprocess(0, 10000);
	int p1, p2;
	 while(scanf("%d %d",&p1,&p2)==2)  {
		process(p1, p2);
	}

}

//	n^2 + n + 41


